import Vue from 'vue'
import VueRouter from 'vue-router'

// 1.通过Vue.use安装路由
Vue.use(VueRouter)

// 2.定义路由映射
const Home= () => import('../views/home/Home');
const Category = () => import('@/views/category/Category')
const Shopcart = () => import('@/views/shopcart/Shopcart')
const Profile = () => import('@/views/profile/Profile')
const Detail =()=> import ('@/views/detail/Detail')

const routes = [
	{
		path: '',
		redirect: '/home'
	},
	{
		path: '/home',
		component: Home
	},
	{
		path: '/category',
		component: Category
	},
	{
		path: '/shopcart',
		component: Shopcart
	},
	{
		path: '/detail/:iid',
		component: Detail
	},

]

// 3.创建对象
const router = new VueRouter({
	mode: 'history',
	routes
})


// 4.到处对象
export default router


